package com.microservice.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

/**
 * @Author Atu
 * @Date 2023/11/18 11:25
 * @Version 1.0
 */
@RestController
public class DemoController {
    @RequestMapping("/hello")
    public Object hello() {
        return "Hello, Microservice ...";
    }

    @RequestMapping("/hello3s")
    public Object hello3s() {
        try {
            TimeUnit.SECONDS.sleep(3);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "Hello, Microservice (Delay 3s) ...";
    }

    @RequestMapping("/hello30s")
    public Object hello30s() {
        try {
            TimeUnit.SECONDS.sleep(30);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "Hello, Microservice (Delay 3s) ...";
    }
}
